package com.situ.mallsdauweb.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.situ.mallsdauweb.entity.Member;
import com.situ.mallsdauweb.mapper.MemberMapper;
import com.situ.mallsdauweb.service.IMemberService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.situ.mallsdauweb.util.RequestUtil;
import jdk.nashorn.internal.ir.RuntimeNode;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author han
 * @since 2023-06-05
 */
@Service
public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> implements IMemberService {

    @Override
    public boolean check(String username, String password) {
        QueryWrapper<Member> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("username",username);
        Member m=baseMapper.selectOne(queryWrapper);
        boolean b=m!=null && m.getPassword().equals(password);
        if (b) {
            RequestUtil.getSession().setAttribute("current",m);
        }
        return b;



    }
}
